import request from "@/utils/request";
// import download from '@/utils/request'

// a案件管理列表
export function caselist(data) {
  return request({
    url: "/system/case/list",
    method: "get",
    params: data,
  });
}

// 归档
export function archiveList(data) {
  return request({
    url: "/system/case/archive",
    method: "get",
    params: data,
  });
}
// 归档
export function archivemine(data) {
  return request({
    url: "/system/case/archive/mine",
    method: "get",
    params: data,
  });
}
// a案件管理详情
export function casedetail(id) {
  return request({
    url: `/system/case/v2/${id}`,
    method: "get",
  });
}
// 客户列表
export function customerlist(data) {
  return request({
    url: "/system/customer/list",
    method: "get",
    params: data,
  });
}
//冲突检索
export function casecheck(data) {
  return request({
    url: "/system/case/check",
    method: "POST",
    data: data,
  });
}

//新增案件
export function caseadd(data) {
  return request({
    url: "/system/case",
    method: "POST",
    data: data,
  });
}
//修改案件
export function caseupdata(data) {
  return request({
    url: "/system/case/v2",
    method: "post",
    data: data,
  });
}

export const batchRemove = (ids) => {
  return request({
    url: '/system/case/remove',
    method: 'POST',
    data: ids
  })
}

//上传
export function upload(data) {
  return request({
    url: "/dev-api/common/upload",
    method: "POST",
    data: data,
  });
}
//下载
export function download(data) {
  return request({
    url: "/common/download",
    method: "get",
    params: data,
  });
}
//导出
export function exportdata(ids) {
  return request({
    url: "/system/case/export?ids=" + ids,
    method: "POST",
    responseType: "blob",
  });
}
// 用户信息列表不分页
export function userlist(data) {
  return request({
    url: "/system/user/all",
    method: "get",
    params: data,
  });
}
// 用户信息列表不分页
export function userlistpage(data) {
  return request({
    url: "/system/user/list",
    method: "get",
    params: data,
  });
}
// 客户管理新增
export function addcustomer(data) {
  return request({
    url: "/system/customer",
    method: "post",
    data: data,
  });
}
// 客户管理修改
export function updatacustomer(data) {
  return request({
    url: "/system/customer",
    method: "put",
    data: data,
  });
}
// 客户名称检测
export function checkcustomer(data) {
  return request({
    url: "/system/customer/check",
    method: "post",
    data: data,
  });
}

// 案件办理
export function caseprocess(data) {
  return request({
    url: "/system/case/process",
    method: "post",
    data: data,
  });
}
// 客户分类树
export function categorytree(data) {
  return request({
    url: "/system/customer/category/tree",
    method: "get",
    data: data,
  });
}
// 客户删除
export function delcustomer(customerIds) {
  return request({
    url: `/system/customer/${customerIds}`,
    method: "delete",
  });
}
// 客户获取详情
export function getcustomer(customerIds) {
  return request({
    url: `/system/customer/${customerIds}`,
    method: "get",
  });
}
// 档案财务信息提交
export function casefinancial(data) {
  return request({
    url: "/system/case/financial",
    method: "post",
    data: data,
  });
}
// 案件管理-结案
export function resolvecase(data) {
  return request({
    url: "/system/case/resolve",
    method: "post",
    data: data,
  });
}
// 案件管理-财务信息销案
export function purgecase(data) {
  return request({
    url: "/system/case/purge",
    method: "post",
    data: data,
  });
}
// 财务信息获取详情
export function getfinance(caseId) {
  return request({
    url: `system/case/${caseId}/finance`,
    method: "get",
  });
}
// 案件审批
export function audit(data) {
  return request({
    url: "/system/case/audit",
    method: "post",
    data: data,
  });
}
// 合同模板下载弹窗----列表
export function agreelist(params) {
  return request({
    url: `/system/agreement_template/list`,
    method: "get",
    params: params,
  });
}
// 合同模板下载弹窗----添加模板
export function agreeadd(data) {
  return request({
    url: `/system/agreement_template`,
    method: "post",
    data: data,
  });
}

// 合同模板下载弹窗----删除模板
export function agreedel(ids) {
  return request({
    url: `/system/agreement_template/${ids}`,
    method: "delete",
  });
}
// 案件归档---
export function archivefile(data) {
  return request({
    url: `/system/case/archive`,
    method: "post",
    data: data,
  });
}

//发票--财务管理
//发票列表
export function invoicelist(params) {
  return request({
    url: `/system/invoice/list`,
    method: "get",
    params: params,
  });
}
//新增
export function invoiceadd(data) {
  return request({
    url: `/system/invoice`,
    method: "post",
    data: data,
  });
}
//获取详情
export function invoicedetail(id) {
  return request({
    url: `/system/invoice/${id}`,
    method: "get",
  });
}
// 财务审批
export function invoiceAudit(data) {
  return request({
    url: `/system/invoice/audit`,
    method: "POST",
    data
  });
}
//删除
export function invoicedel(ids) {
  return request({
    url: `/system/invoice/${ids}`,
    method: "delete",
  });
}

//当事人修改
export function parties(data) {
  return request({
    url: `system/case/parties`,
    method: "post",
    data: data,
  });
}

//退案
export function revoke(data) {
  return request({
    url: `system/case/revoke`,
    method: "post",
    data: data,
  });
}
//退案审批
export function revokeAudit(data) {
  return request({
    url: `system/case/revoke/audit`,
    method: "post",
    data: data,
  });
}
//退案审批
export function deleCase(id) {
  return request({
    url: `/system/case/` + id,
    method: "delete",
  });
}



// 默认审批人员列表
/**
 *
 * @param { type } 财务审批人1、案件审批人2、用印审批人3
 * @returns
 */
export function defaultList(params) {
  return request({
    url: 'system/default_audit_user',
    method: 'get',
    params: params,
  })
}

// 新增默认审批人员
export function setDefault(data, type) {
  return request({
    url: 'system/default_audit_user?type=' + type,
    method: 'post',
    data
  })
}

// 新增默认审批人员
export function delDefault(ids, type) {
  return request({
    url: 'system/default_audit_user/' + ids + '?type=' + type,
    method: 'delete'
  })
}
